<?php 
class Application_Form_Session  extends Twitter_Bootstrap_Form_Horizontal
{
	 


	public function init()
	{
		$this->setMethod("post");
		
		$decorators=array(
    			array('ViewHelper', array('tag'   => 'div', "class"=>"controls")),
    			array('Label' , array(  "class"=>"control-label")),
    			'Errors',
    			new Zend_Form_Decorator_HtmlTag(array(
    					'tag'   => 'div', "class"=>"control-group"
    			))
    	);
		
		$translate = Zend_Registry::get('Zend_Translate');
		$translate->setLocale('fr');
		
		$titre = new Zend_Form_Element_Text('titre');
		$titre->setRequired(true)
		->setAttrib("class", "input-large");
		$titre->setLabel("Titre: ");
		$titre->setDecorators($decorators);
		$this->addElement($titre);
		
		
		
		
		
		$typesession= new Zend_Form_Element_select('typesession');
		$typesession->setRequired(true)
		->addMultiOption( "","");
		$typesession->setLabel("Type session: ");
		$sess_model=new Application_Model_DbTable_Certification();
		$sess_record=$sess_model->fetchAll();
		$typesession->addMultiOption( "","");
		if($sess_record){
			$respons=$sess_record->toArray();
			foreach ($respons as $value){
				$typesession->addMultiOption($value['id_certification'],$value['type_certification'] );
			}
		}
		$typesession->setValue("type_certification");
		
		$typesession->setDecorators($decorators);
		$this->addElement($typesession);
		
		$datedebut = new Zend_Form_Element_Text('datedebut');
		$datedebut->setRequired(true)
		->setAttrib("class", "input-large");
		$datedebut->setLabel("Date debut: ");
		$datedebut->setDecorators($decorators);
		$this->addElement($datedebut);
		
		$datefin = new Zend_Form_Element_Text('datefin');
		$datefin->setRequired(true)
		->setAttrib("class", "input-large");
		$datefin->setLabel("Date fin: ");
		$datefin->setDecorators($decorators);
		$this->addElement($datefin);
		
		
		$debutinscri = new Zend_Form_Element_Text('debutinscri');
		$debutinscri->setRequired(true)
		->setAttrib("class", "input-large");
		$debutinscri->setLabel("Date debut d'inscription: ");
		$debutinscri->setDecorators($decorators);
		$this->addElement($debutinscri);
		
		
		$fininscri = new Zend_Form_Element_Text('fininscri');
		$fininscri->setRequired(true)
		->setAttrib("class", "input-large");
		$fininscri->setLabel("Date fin d'inscription: ");
		$fininscri->setDecorators($decorators);
		$this->addElement($fininscri);
		
		
		$etat = new Zend_Form_Element_Radio('etat');
		$etat->setRequired(true);
		$etat->setMultiOptions(array('Active'=>'Active', 'Annulee'=>'Annulee'));
		$etat->setLabel("Etat: ");
		$etat->setSeparator('');
		$etat->setDecorators($decorators);
		$this->addElement($etat);
		$etat->setValue("Active");
		
		//$etat = new Zend_Form_Element_Checkbox('etat');
		//$etat->setRequired(true);
		//$etat->setChecked("Active","Active");
		//$etat->addMultiOption("Annulee","Annulee");
		//$etat->setLabel($translate->_('Etat de session').'* : ');
		//$etat->setDecorators($decorators);
		//$this->addElement($etat);
		
		$sendBt = new Zend_Form_Element_Submit('enregistrer');
		$sendBt->setLabel('Enregistrer');
		$sendBt->setAttrib('class', 'btn');
		$this->addElement($sendBt);
		
		$annuler = new Zend_Form_Element_Reset('annuler');
		$annuler->setLabel('Annuler');
		$annuler->setAttrib('class', 'btn');
		$this->addElement($annuler);
		
		$sendBt->setDecorators(array('ViewHelper'));
		$annuler->setDecorators(array('ViewHelper'));
		
	}
}
